home *** CD-ROM | disk | FTP | other *** search
- Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
- From: grantp@usa.pipeline.com(Pete Grant)
- Newsgroups: comp.lang.c++
- Subject: Re: MS VC++ 4.0 namespace weirdness
- Date: 21 Mar 1996 00:47:21 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4iq8up$hl3@news1.h1.usa.pipeline.com>
- References: <4ip987$aj5@druid.borland.com>
- NNTP-Posting-Host: 38.8.60.5
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete Grant)
- X-Newsreader: Pipeline v3.5.0
-
- On Mar 20, 1996 15:46:15 in article <Re: MS VC++ 4.0 namespace weirdness>,
- 'pete@borland.com (Pete Becker)' wrote:
-
-
- >In article <314D9E46.433@lydian.lc.att.com>, shaw@lydian.lc.att.com
- says...
- >>
- >>[Hope this is the right group -- didn't see a VC++-specific one]
- >>
- >>If I define a namespace in an include file, the classes within
- >>that
- >>namespace are not recognized by the MS VC++ 4.0 class window.
- >>If I
- >>define the namespace in the including file, they are. Any
- >>opinions
- >>on this anomaly?
- >>
- >> Thanks,
- >> andrew.shaw@att.com
- >>
- >>Example:
- >>
- >>// foo1.hpp
- >>namespace FOO1
- >>{
- >>class X1 { int x1; };
- >>}
- >>
- >>// foo2.hpp
- >>class X2 { int x2; };
- >>
- >>// foo.cpp
- >>#include "foo1.hpp" // whereis FOO1::X1?
- >>namespace FOO2
- >>{
- >>#include "foo2.hpp" // FOO2::X2 no problem
- >>}
- >
- >Don't do this. I know, Microsoft recommends this as the technique for
- getting
- >the public domain version of STL that they slapped onto their CD into a
- >namespace. Bottom line is it doesn't work, and it will cause endless
- problems.
- >
- >If the header wasn't written with namespaces in mind don't try to force it
- into
- >a namespace. Namespaces are not something you throw in, they're something
- you
- >design in. If the design isn't there it's not going to work.
- >
- I guess Pete is referring to case two (FOO2), and I suppose it's sound
- advice.
- But it doesn't address the question.
-
- I have used namespace declarations inside header files, as in FOO1 above,
- and have had no problems. The namespaces behave precisely as expected when
-
- compiled with MSVC++4.0/4.1. I suspect the original poster's problem may
- be
- something not shown in the code snippets furnished.
-
- Sample code available upon request.
- --
- Pete Grant
- Kalevi, Inc.
- Software Engineering & development
-